export const addIntroduceList = (editor) => {
    const {
        Components
    } = editor;
    Components.addType('introduceList', {
        model: {
            defaults: {
                name: 'introduceList',
                droppable: false,
                components: [{
                    type: 'div',
                    attributes: { class: 'home', },
                    components: [{
                        type: 'div',
                        attributes: { class: 'bc', },
                        components: [{
                            type: 'div',
                            attributes: { class: 'bc_red' },
                            components: [{
                                type: 'text',
                                content: '07.06'
                            }]
                        },
                        {
                            type: 'div',
                            attributes: { class: 'bc_gray' },
                            components: [{
                                type: 'text',
                                content: '2024'
                            }]
                        },
                        {
                            type: 'div',
                            attributes: { class: 'bc_bottom' },
                        },
                        ]
                    },
                    {
                        type: 'div',
                        components: [{
                            type: 'div',
                            attributes: { class: 'news_title' },
                            components: [{
                                type: 'link',
                                content: '1文章标题(这里输出的是文章标题)'
                            }
                            ]
                        },
                        {
                            type: 'div',
                            attributes: { class: 'news_content' },
                            components: [{
                                type: 'text',
                                attributes:{class: 'news_text'},
                                content: '这里是文章内容简介，内容简介长度会很长，当显示简介的时候，配置的字符长度对文章标题和简介都起作用，所以字体会隐藏。'
                            }
                            ]
                        }
                    ]
                    }
                    ],

                }],
                script() {
                },
                styles: `
            
        .home {
        display: flex;
    }

    .news_content {
        width: 750px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .news_text {
        margin-left: 10px;
        margin-top: 5px;
        font-weight: 300;
        font-size: 14px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .news_title {
        margin-left: 10px;
        margin-top: 5px;
        width: 240px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .bc_bottom {
        height: 5px;
        background-color: rgb(214, 212, 212);
    }

    .bc {
        width: 60px;
    }

    .bc_red {
        background-color: rgb(196, 85, 85);
        text-align: center;
        padding: 3px;
        color: #fff;
    }

    .bc_gray {
        background-color: rgb(246, 233, 233);
        text-align: center;
        padding: 3px;
    }
                `,
            },

        },
    });

    // 注册 introduceList 组件
    editor.BlockManager.add('introduceList', {
        label: '新闻介绍列表',
        category: '新闻类',
        media:`<svg t="1720769982942" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="48685" width="30" height="30"><path d="M0 36.588308l256 0L256 256 0 256 0 36.588308zM292.588308 109.725538 1024 109.725538 1024 36.588308 292.588308 36.588308 292.588308 109.725538zM0 621.725538l256 0 0-219.451077L0 402.274462 0 621.725538zM292.588308 475.411692 1024 475.411692l0-73.137231L292.588308 402.274462 292.588308 475.411692zM0 987.411692l256 0L256 768 0 768 0 987.411692zM292.588308 841.137231 1024 841.137231 1024 768 292.588308 768 292.588308 841.137231zM292.588308 182.862769l146.274462 0L438.862769 146.274462 292.588308 146.274462 292.588308 182.862769zM402.274462 256 512 256 512 219.411692l-109.725538 0L402.274462 256zM548.588308 256l73.137231 0L621.725538 219.411692l-73.137231 0L548.588308 256zM475.411692 182.862769l146.313846 0L621.725538 146.274462l-146.313846 0L475.411692 182.862769zM292.588308 256l73.137231 0L365.725538 219.411692 292.588308 219.411692 292.588308 256zM658.274462 182.862769l146.313846 0L804.588308 146.274462l-146.313846 0L658.274462 182.862769zM768 256l109.725538 0L877.725538 219.411692 768 219.411692 768 256zM841.137231 182.862769 1024 182.862769 1024 146.274462l-182.862769 0L841.137231 182.862769zM658.274462 256l73.137231 0L731.411692 219.411692l-73.137231 0L658.274462 256zM292.588308 548.588308l146.274462 0L438.862769 512 292.588308 512 292.588308 548.588308zM402.274462 621.725538 512 621.725538l0-36.588308-109.725538 0L402.274462 621.725538zM548.588308 621.725538l73.137231 0 0-36.588308-73.137231 0L548.588308 621.725538zM475.411692 548.588308l146.313846 0L621.725538 512l-146.313846 0L475.411692 548.588308zM292.588308 621.725538l73.137231 0 0-36.588308L292.588308 585.137231 292.588308 621.725538zM658.274462 548.588308l146.313846 0L804.588308 512l-146.313846 0L658.274462 548.588308zM768 621.725538l109.725538 0 0-36.588308L768 585.137231 768 621.725538zM841.137231 548.588308 1024 548.588308 1024 512l-182.862769 0L841.137231 548.588308zM658.274462 621.725538l73.137231 0 0-36.588308-73.137231 0L658.274462 621.725538zM292.588308 914.274462l146.274462 0 0-36.548923L292.588308 877.725538 292.588308 914.274462zM402.274462 987.411692 512 987.411692l0-36.588308-109.725538 0L402.274462 987.411692zM548.588308 987.411692l73.137231 0 0-36.588308-73.137231 0L548.588308 987.411692zM475.411692 914.274462l146.313846 0 0-36.548923-146.313846 0L475.411692 914.274462zM292.588308 987.411692l73.137231 0 0-36.588308L292.588308 950.823385 292.588308 987.411692zM658.274462 914.274462l146.313846 0 0-36.548923-146.313846 0L658.274462 914.274462zM768 987.411692l109.725538 0 0-36.588308L768 950.823385 768 987.411692zM841.137231 914.274462 1024 914.274462l0-36.548923-182.862769 0L841.137231 914.274462zM658.274462 987.411692l73.137231 0 0-36.588308-73.137231 0L658.274462 987.411692z" p-id="48686"></path></svg>`,
        content: {
            type: 'introduceList'
        },
    });
};